﻿Public Class sidebar

    Private Sub sidebar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Enabled = True
        Timer1.Interval = 100
        Timer2.Enabled = False  ' for now
        Timer2.Interval = 1000
        If Main.Visible Then
            Exit Sub
        Else
            Me.Visible = True
            Dim x As Integer
            Dim y As Integer
            x = Screen.PrimaryScreen.WorkingArea.Width
            y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

            Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width
                x = x - 1
                Me.Location = New Point(x)
            Loop
        End If
    End Sub
    
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If Me.Location.X < 1366 Then         ' Attempt to auto corrent a error where sidebar is in wrong position. X always is < 1366
            Dim x As Integer
            Dim y As Integer
            x = Screen.PrimaryScreen.WorkingArea.Width
            y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

            Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width
                x = x - 1
                Me.Location = New Point(x)
            Loop
        End If
        
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs)
        KHM.Main.Button7_Click(sender, New System.EventArgs())
    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        On Error Resume Next
        Dim url As String = "https://pb1.mdeca.org/parentaccess/General/LoginPage.aspx?DistrictID=224"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
        On Error Resume Next
        Dim url As String = "https://pilot.wright.edu"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
        On Error Resume Next
        Dim url As String = "https://outlook.com"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles Button9.Click
        On Error Resume Next
        Dim url As String = "https://skydrive.live.com"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Main.Show()
        If Main.WindowState = FormWindowState.Minimized Then
            Main.WindowState = FormWindowState.Maximized
        End If
        Me.Close()
    End Sub
End Class
' © 2012 Matthew Kowal
'    This program is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.

'    This program is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with this program.  If not, see <http://www.gnu.org/licenses/>